package com.zznj.xzjc.adapter.index;

import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.zznj.xzjc.R;
import com.zznj.xzjc.bean.index.PushData;
import com.zznj.xzjc.bean.index.XsglData;
import com.zznj.xzjc.utils.StringUtils;
import com.zznj.xzjc.utils.TimeUtils;

import java.util.List;

/**
 * 描述：添加类的描述
 *
 * @author wx5e48d604c2885118
 * @time 2020/4/7
 */
public class XsglAdapter extends BaseQuickAdapter<XsglData, BaseViewHolder> {
    private int type;
    public XsglAdapter(int layoutResId, @Nullable List<XsglData> data,int type) {
        super(layoutResId, data);
        this.type = type;
    }

    @Override
    protected void convert(BaseViewHolder helper, XsglData item) {
        helper.setText(R.id.xsNo,item.getClueNo())
                .setText(R.id.cjbm,"创建部门："+item.getCreateDeptName())
                .setText(R.id.cjdw, "创建单位："+ StringUtils.toStringForWu(item.getCreateOrgName()))
                .setText(R.id.cjsj, "创建时间："+TimeUtils.getTime(item.getCreateTime(),"yyyy-MM-dd"));
        TextView ajzt = helper.getView(R.id.ajzt);
        if(type == 0){
            helper.getView(R.id.jsbm).setVisibility(View.GONE);
            ajzt.setText("待分派");
        }else{
            helper.getView(R.id.jsbm).setVisibility(View.VISIBLE);
            helper.setText(R.id.jsbm,"接收单位："+StringUtils.toStringForWu(item.getReceiveOrgName()));
            if("2".equals(item.getClueState())){
                ajzt.setText("已分派");
                ajzt.setBackgroundResource(R.drawable.btn_xsgl_yfp_shape);
                ajzt.setTextColor(mContext.getResources().getColor(R.color.xsgl_yfp_color));
            }else if("3".equals(item.getClueState())){
                ajzt.setText("已受理");
                ajzt.setBackgroundResource(R.drawable.btn_xsgl_ysl_shape);
                ajzt.setTextColor(mContext.getResources().getColor(R.color.xsgl_ysl_color));
            }
        }
    }
}
